package com.ruicar.afs.cloud.afscase.approvetask.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruicar.afs.cloud.afscase.approvetask.entity.ApproveTeleRecord;
import com.ruicar.afs.cloud.afscase.approvetask.mapper.ApproveTeleRecordMapper;
import com.ruicar.afs.cloud.afscase.approvetask.service.ApproveTeleRecordService;
import com.ruicar.afs.cloud.afscase.common.dto.IntelligentVoiceDto;
import com.ruicar.afs.cloud.afscase.common.service.IntelligentVoiceService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @description:语音转文字
 * @author jiaqi.guo
 * @created 2020/8/21 11:53
 * @version 1.0
 */

@Service
@AllArgsConstructor
@Data
@Slf4j
public class ApproveTeleRecordServiceImpl extends ServiceImpl<ApproveTeleRecordMapper, ApproveTeleRecord> implements ApproveTeleRecordService {
    private IntelligentVoiceService intelligentVoiceService;
    /**
     * 获取任务id
     *
     * @param
     * @return
     */
    public  String getRecordingId(String url) {
        IntelligentVoiceDto dto = new IntelligentVoiceDto();
        dto.setFileLink(url);
        String taskId = intelligentVoiceService.getTaskId(dto);
        return taskId;
    }

    /**
     * 获取录音文本
     *
     * @param
     * @return
     */
      public JSONObject getMessageInfo(String taskId) {
        IntelligentVoiceDto dto = new IntelligentVoiceDto();
        dto.setTaskId(taskId);
        return intelligentVoiceService.getMessageInfo(dto);
    }
}

